package com.lz.sports.vm

import androidx.lifecycle.LifecycleOwner
import com.lz.comm.SP
import com.lz.comm.net.HttpManager
import com.lz.helper.HelperConfig
import com.lz.library.base.BaseModel
import com.lz.library.base.BaseViewModel
import com.lz.library.extension.APP
import com.lz.sports.core.K_SERVER_ADDRESS
import com.lz.sports.core.VerifyManager
import com.lz.sports.core.v_server_address

class WelcomeViewModel : BaseViewModel<BaseModel>() {

    override fun onCreate(owner: LifecycleOwner) {
        HelperConfig.init(APP)
        VerifyManager
        val server = SP.getString(K_SERVER_ADDRESS, v_server_address)
        if (server != null && HttpManager.isEffectiveServer(server)) {
            HttpManager.modifyBaseUrl(server)
        } else {
            HttpManager.clearBaseUrl()
        }
    }

}